{include file='_header'}

<div class="page-header">
    当前位置：<span class="text-primary">专题管理</span>
 </div>

<div class="page-content">
<form action="" method="get" class="form-horizontal form-search" role="form">
    <div class="page-toolbar m-b-sm m-t-sm">
        <div class="col-sm-4">
            <span class=''>
                <a class='btn btn-primary btn-sm' href="{:url('admin/seckill/taskadd')}"><i class='fa fa-plus'></i> 添加秒杀</a>
            </span>
        </div>
        <div class="col-sm-6 pull-right">
            <div class="input-group">
                <div class="input-group-select">
                    <select name="enabled" class='form-control'>
                        <option value="" {if $_GET['enabled'] == ''} selected{/if}>状态</option>
                        <option value="1" {if $_GET['enabled']== '1'} selected{/if}>启用</option>
                        <option value="0" {if $_GET['enabled'] == '0'} selected{/if}>禁用</option>
                    </select>
                </div>
                <input type="text" class="input-sm form-control" name='keyword' value="{$_GET['keyword']}" placeholder="请输入关键词">
                <span class="input-group-btn">
                    <button class="btn btn-primary" type="submit"> 搜索</button>
                </span>
            </div>
        </div>
    </div>
</form>

<form action="" method="post">
    {if count($list)>0}
    <div class="page-table-header">
        <input type="checkbox">
        <div class="btn-group">
            <button class="btn btn-default btn-sm btn-operation" type="button" data-toggle='batch' data-href="{:url('admin/seckill/taskenabled',array('enabled'=>1))}">
                <i class='icow icow-qiyong'></i> 启用
            </button>
            <button class="btn btn-default btn-sm btn-operation" type="button" data-toggle='batch'  data-href="{:url('admin/seckill/taskenabled',array('enabled'=>0))}">
                <i class='icow icow-jinyong'></i> 禁用
            </button>
            <button class="btn btn-default btn-sm btn-operation" type="button" data-toggle='batch-remove' data-confirm="确认要删除?" data-href="{:url('admin/seckill/taskdelete')}">
                <i class='icow icow-shanchu1'></i> 删除
            </button>
        </div>
    </div>
    <table class="table table-responsive table-hover" >
        <thead class="navbar-inner">
        <tr>
            <th style="width:25px;"></th>
            <th>专题名称</th>
            <th>会场数</th>
            <th>启用</th>
            <th>创建时间</th>
            <th style="width: 115px;">操作</th>
        </tr>
        </thead>
        <tbody>
        {foreach name='list' item='row'}
        <tr>
            <td>
                <input type='checkbox'   value="{$row['id']}"/>
            </td>
            <td>
                {if $row['usedDate']}
                <span class="label label-primary">{$row['usedDate']}</span>
                {if $row['usedDate']==date('Y-m-d')}
                <span class="label label-danger">当前秒杀</span>
                {/if}
                <br/>
                {/if}
                <span class="text text-danger">[{$category[$row['cateid']]['name']}]</span>{$row['title']}</td>
            <td>
                {$row['roomcount']}
            </td>
            <td>
                <span class='label {if $row['enabled']==1}label-primary{else}label-default{/if}'
                data-toggle='ajaxSwitch'
                data-switch-value='{$row['enabled']}'
                data-switch-value0='0|禁用|label label-default|{:url('admin/seckill/taskenabled',array('enabled'=>1,'id'=>$row['id']))}'
                data-switch-value1='1|启用|label label-primary|{:url('admin/seckill/taskenabled',array('enabled'=>0,'id'=>$row['id']))}'
                style="cursor: pointer;"
                >
                {if $row['enabled']==1}启用{else}禁用{/if}</span>
            </td>
            <td>
                {:date('Y-m-d',$row['createtime'])}<br/>{:date('H:i:s',$row['createtime'])}
            </td>
            <td style="text-align:left;">
                <a href="{:url('admin/seckill/taskedit', array('id' => $row['id']))}" class="btn btn-default btn-sm btn-op btn-operation">
                     <span data-toggle="tooltip" data-placement="top" title="" data-original-title="编辑">
                        <i class="icow icow-bianji2"></i>
                     </span>
                </a>
                <a href="{:url('admin/seckill/room', array('taskid' => $row['id']))}" class="btn btn-default btn-sm  btn-op btn-operation">
                     <span data-toggle="tooltip" data-placement="top" title="" data-original-title="会场管理">
                        <i class="icow icow-huichang"></i>
                     </span>
                </a>
                <a href="{:url('admin/seckill/good', array('taskid' => $row['id']))}" class="btn btn-default btn-sm btn-op btn-operation">
                     <span data-toggle="tooltip" data-placement="top" title="" data-original-title="商品统计">
                        <i class="icow icow-goods"></i>
                     </span>
                </a>
                <a data-toggle='ajaxRemove' href="{:url('admin/seckill/taskdelete', array('id' => $row['id']))}"class="btn btn-default btn-sm btn-op btn-operation" data-confirm='确认要删除此秒杀吗?'>
                    <span data-toggle="tooltip" data-placement="top" title="" data-original-title="删除">
                        <i class="icow icow-shanchu1"></i>
                     </span>
                </a>
            </td>
        </tr>
        {/foreach}
        </tbody>
        <tfoot>
            <tr>
                <td><input type="checkbox"></td>
                <td colspan="2">
                    <div class="btn-group">
                        <button class="btn btn-default btn-sm btn-operation" type="button" data-toggle='batch' data-href="{:url('admin/seckill/taskenabled',array('enabled'=>1))}">
                            <i class='icow icow-qiyong'></i> 启用
                        </button>
                        <button class="btn btn-default btn-sm btn-operation" type="button" data-toggle='batch'  data-href="{:url('admin/seckill/taskenabled',array('enabled'=>0))}">
                            <i class='icow icow-jinyong'></i> 禁用
                        </button>
                        <button class="btn btn-default btn-sm btn-operation" type="button" data-toggle='batch-remove' data-confirm="确认要删除?" data-href="{:url('admin/seckill/taskdelete')}">
                            <i class='icow icow-shanchu1'></i> 删除
                        </button>
                    </div>
                </td>
                <td colspan="3" class="text-right">{$pager}</td>
            </tr>
        </tfoot>
    </table>
    {else}
    <div class='panel panel-default'>
        <div class='panel-body' style='text-align: center;padding:30px;'>
            暂时没有任何秒杀!
        </div>
    </div>
    {/if}

</form>
</div>
{include file='_footer'}
